#ifndef DEF_STATE
#define DEF_STATE

#include <QPixmap>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QGraphicsSimpleTextItem>
#include <QImage>
#include <QStringList>


class Player;

class State
{
    public:
        State(const QString& name, QGraphicsScene* scene);
        const QPixmap& pixmap() const { return m_px; }
        const QImage& image() const { return m_img; }
        void setPlayer(Player* player);
        Player* player() const { return m_player; }
        bool isInState(const QPoint& point) const;
        const QStringList& connexions() const { return m_connexions; }
        const QString& name() const {return m_name; }
        const QString& continent() const {return m_continent; }
        void addTroops(size_t n) { m_troops += n; refresh();}
        size_t troops() const { return m_troops; }
        void delTroops(size_t n) { m_troops -= n; refresh();}

        void reset() {m_flag = false; }
        bool flag() const {return m_flag; }
        void freeze() {m_flag = true; }

        QString trName() const;
        QString trContinent() const;

    private:

        void refresh();

        bool m_flag;

        QString m_name;
        QString m_continent;
        QStringList m_connexions;

        QPoint m_textCoord;
        QGraphicsSimpleTextItem* m_text;

        QPixmap m_px;
        QGraphicsPixmapItem* m_gpx;

        QImage m_img;

        size_t m_troops;

        Player* m_player;

        QGraphicsScene* m_scene;
};

#endif
